#ifndef prs_FrmImage_H
#define prs_FrmImage_H

#include "prs_FrmFunc.h"
#include "prs_Rule.h"
#include "prs_FrmControl.h"
#include "prs_FrmRules.h"
#include "prs_FrmGeom.h"
#include "prs_FrmImageStyle.h"
#include "frm_control_TImage.h"

namespace prs {

///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmImage : public TNodeFrmControl
{
  DECLARE_ClientNode()
  //
  typedef TNodeFrmImageStyle   TStyle;
  typedef frm::control::TImage TControl;
  //
  TAttrNodeType<nodeType_Image> NodeType;
  TAttrString<attrName_Value> Value;
  TAttrPointerNoCopy<attrName_Control,frm::control::TImage*> Control;
  //
  TNodeFrmImage() : NodeType(this),Control(this),Value(this) {}
 ~TNodeFrmImage() { delete Control.GetValue();}
  
private:
  svl_Except();
};
                   
///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmImage : public snt::TRule
{
  TRuleFrmImage(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmChildrenBase &RChildren,
    TRuleSetNodeIdOptionally &RSetNodeIdOptionally,
    TRuleSetAttrValue &RSetAttrValue,
    TRuleFrmGeom &RFrmGeom,
    TRuleSetStyle &RStyle
  );

private:  
  TNodeFrmImage *GetNode() { return dynamic_cast<TNodeFrmImage*>(vParentNode.Pointer());}
  //
  void FSetGeometry(snt::TParams &Params) { rGeometry.SetGeom( &GetNode()->Geometry.Value );}
  bool FSetImage(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FSetValue(TRuleSetAttrValue::TFuncValueIdentParams &Params);
  //
  svl::TVariant &vParentNode;
  TRuleFrmGeom &rGeometry;
  snt::TRule  RAttr,RAttr1;
  snt::TAlter AAttr1;
  svl_Except;
};

///////////////////////////////////////////////////////////////////////////////
}

#endif
